// #ifndef VUE3
import Vue from 'vue'
import App from './App'
// 导入请求配置文件
import './common/request.js'
//导入 store 的实例对象
import store from './store/store.js'
import './uni.scss'
//引入uView
import uView from "uview-ui";
Vue.use(uView);

Vue.config.productionTip = false
Vue.prototype.toPage = (path) => {
	console.log('跳转页面',path)
	if (path && path.indexOf('/pages') == -1) {
		wx.navigateTo({
			url: path
		})
	} else if (path && path.indexOf('/pages') != -1) {
		wx.switchTab({
			url: path
		})
	} else {
		return uni.$showMsg('功能敬请期待')
	}	
},
Vue.prototype.$beforeLogin = function(){
	if(!uni.getStorageSync('ylToken')){
		uni.showModal({
			content:"还未登录，请先登录",
			success(res) {
				if(res.confirm){
					uni.navigateTo({
						url:'/subPackages/login/login'
					})
				}else{
					uni.navigateBack()
				}
			},
		})
	}
}
App.mpType = 'app'

const app = new Vue({
	...App,
	//  将 store 挂载到 Vue 实例上
	store
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
import App from './App.vue'

export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif
